package com.trkj.controller;

import java.math.BigDecimal;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.trkj.service.HwcSchedulingService;
import com.trkj.vo.DayWeekVO;
import com.trkj.vo.Result;
/**
 * 排班控制器
 * @author lenovo
 *
 */
@Controller
public class HwcSchedulingController {
	
	@Autowired
	private HwcSchedulingService schedulingService; 	
	
	/**
	 * 跳转排班页面
	 * @return
	 */
	@RequestMapping("/to_hwcScheduling")
	public String toScheduling(){
		return "hwc_scheduling";
	}
	
	
	/**
	 * 返回本周的时间
	 * @return
	 */
	@RequestMapping("/hwc_getDayWeekVO")
	public @ResponseBody List<DayWeekVO> getDayWeekVO(){
		List<DayWeekVO> dv = schedulingService.getDayWeek();
		System.out.println(dv.size());
		return dv;
	}
	
	/**
	 * 添加排班计划
	 * @param staffNo
	 * @param shiftNo
	 * @param departmentNo
	 * @param schedulingDate
	 * @return
	 */
	@RequestMapping("/hwc_addScheduling")
	public @ResponseBody Result addScheduling(long staffNo,long shiftNo,long departmentNo,String schedulingDate){
		schedulingService.addScheduling(staffNo, shiftNo, departmentNo, schedulingDate);
		return new Result(true,"排班计划添加成功！");
	}
	/**
	 * 查询班次名
	 * @param staffNo
	 * @return
	 */
	@RequestMapping("/hwc_queryShiftName")
	public @ResponseBody List<String>	queryShiftName(long staffNo){
		return schedulingService.queryShiftNo(new BigDecimal(staffNo));
	}
	
}
